home *** CD-ROM | disk | FTP | other *** search
/ Dioses Mayas / Dioses Mayas.iso / DEMO1 / MAYAS / TITLE.MST < prev    next >
Text File  |  1996-09-06  |  16KB  |  485 lines

  1. '**************************************************************************
  2. '*
  3. '* Corear.MST - Viewer Runtime Setup Script
  4. '*
  5. '* CUSTOMIZING KimDEMO.MST
  6. '*
  7. '* For a simple Setup routine, you just need to assign values to the 
  8. '* series of variables following the heading "Setup Variables". This
  9. '* script also provides for the following more-advanced options, which
  10. '* are supported by subroutines located later in this script:
  11. '*
  12. '* Option                                         See Subroutine
  13. '* ------------------------------------------     ---------------------
  14. '* Install more than one .MVB file                ModifyViewerIni
  15. '* Install Help title                             ModifyViewerIni
  16. '* Install custom DLLs                            ModifyViewerIni
  17. '* Install multiple Program Manager items         ModifyProgramManager
  18. '* Display a custom icon with the ProgMan item    ModifyProgramManager
  19. '* Install custom fonts                           RegisterCustomFonts
  20. '* Install Video for Windows runtime files        RegisterDrivers
  21. '*
  22. '* Each customization note starts with the heading CUSTOMIZATION.
  23. '*
  24. '**************************************************************************
  25.     
  26.     '' Global variables
  27.  
  28.     GLOBAL TitleShortName$
  29.     GLOBAL TitleLongName$
  30.     GLOBAL Garabatos$
  31.     GLOBAL PromptForPath%
  32.     GLOBAL DefaultPath$
  33.     GLOBAL ProgManGroup$
  34.     GLOBAL ProgManItemGarabatos$
  35.  
  36.     '' ****************************************************************
  37.     '' ** Setup Variables
  38.     '' ****************************************************************
  39.  
  40.     '' Set the following string to a short form of the title name
  41.     '' (for example, "Gallery")
  42.     
  43.     TitleShortName$ = "Dioses Mayas"
  44.     
  45.     '' Set the following string to a long form of the title name
  46.     '' (for example, "Viewer 2.0 Gallery")
  47.     
  48.     '' TitleLongName$ = "Kimera - Cuentos para Leer, Colorear y jugar"
  49.  
  50.     '' Set the following variable to the name of the MVB file, without 
  51.     '' the filename extension (for example, "GALLERY")
  52.         
  53.     Garabatos$ = "Mayas"
  54.         
  55.     '' The following variable determines whether Setup prompts the user
  56.     '' to specify a directory in which to install title files. (Files
  57.     '' to be installed on the hard disk must be listed in the TITLE.INF 
  58.     '' file under the [Installed Title Files] section.) Specify one of
  59.     '' the following values:
  60.     ''
  61.     '' 0    Install title files in the Windows directory (default setting).
  62.     ''      This is an appropriate setting if you have a limited number
  63.     ''      of files to copy (for example, a single custom icon or DLL).
  64.     ''
  65.     '' 1    Display a dialog box to prompt the user for a directory in 
  66.     ''      which to install files
  67.         
  68.     PromptForPath% = 1
  69.         
  70.     '' If you have specified 1 in PromptForPath%, set the following 
  71.     '' variable to the default path that will be displayed in the dialog
  72.     '' box (for example, "C:\GALLERY").
  73.         
  74.     DefaultPath$ = "C:\Kimera\Mayas"
  75.     
  76.     '' Set the following variable to the name of the program manager 
  77.     '' group you would like to create (for example, "Viewer 2.0 Gallery")
  78.         
  79.     '' ProgManGroup$ = "Kimera - Cuentos para Leer, Colorear y Jugar"
  80.     ProgManGroup$ = "Kimera - Cuentos"
  81.     
  82.     '' Set the following variable to the caption of the program manager 
  83.     '' item for your title (for example, "Gallery")
  84.         
  85.     ProgManItemGarabatos$ = "Dioses Mayas"
  86.     
  87.     '***********************************************************************
  88.     '** Mainline
  89.     '***********************************************************************
  90.  
  91.     GLOBAL CUIDLL$
  92.  
  93.     '' Include files
  94.     '$INCLUDE 'setupapi.inc'
  95.     
  96.     '' Custom UI dll
  97.     CUIDLL$ = "mscuistf.dll"
  98.     
  99.     '' Dialog ID's
  100.     CONST DESTPATH      = 1000
  101.     CONST APPHELP       = 2000
  102.     CONST TOOBIG        = 3000
  103.     CONST BADPATH       = 4000
  104.     CONST SUCCESS       = 5000
  105.     
  106.     '' Bitmap ID
  107.     CONST LOGO = 1
  108.     
  109.     '' Functions and subroutines
  110.     DECLARE FUNCTION AddFont LIB "mscuistf.dll" (szFont$, szName$) AS INTEGER
  111.     DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  112.     DECLARE FUNCTION GetTitleDir (szDefault$) AS STRING
  113.     DECLARE FUNCTION CopyFiles(szTitleDir$) AS INTEGER
  114.     DECLARE SUB RegisterFont(fontfile$, fontname$)
  115.     DECLARE SUB ModifyViewerIni
  116.     DECLARE SUB RegisterCustomFonts
  117.     DECLARE SUB ModifyProgramManager
  118.     DECLARE SUB ShowSuccess
  119.     DECLARE SUB RegisterDrivers
  120.     
  121.     '' The following statement turns size checking off. Set it to scmOnFatal 
  122.     '' to enable size checking, where Setup will compare the disk file size 
  123.     '' with the INF file size and report an error if they are not the same.
  124.     
  125.     i% = SetSizeCheckMode(scmOff)
  126.     
  127.     '' Set the title and banner bitmap. You must rebuild MSCUISTF.DLL to 
  128.     '' alter the banner bitmap.
  129.     
  130.     SetTitle "Kimera - Cuentos para Leer, Colorear y Jugar - Dioses Mayas"
  131.     SetBitmap CUIDLL$, LOGO 
  132.     
  133.     '' Read in the INF file.
  134.     
  135.     ReadInfFile GetSymbolValue("STF_CWDDIR") + "TITLE.INF"
  136.     
  137.     '' Decide where to put title files
  138.     IF PromptForPath% = 1 THEN
  139.         szTitleDir$ = GetTitleDir(DefaultPath$)
  140.                 DefaultPath$ = szTitleDir$
  141.         IF szTitleDir$ = "" THEN
  142.             GOTO QUIT
  143.         ENDIF
  144.     ELSE
  145.         szTitleDir$ = GetWindowsDir()
  146.     ENDIF   
  147.     
  148.     '' Copy files
  149.     IF CopyFiles(szTitleDir$) = 0 THEN
  150.         GOTO QUIT
  151.     ENDIF
  152.  
  153.     '' Create the MVIEWER2.EXE MVB association 
  154.     CreateIniKeyValue "WIN.INI", "Extensions", "MVB", "mviewer2.exe", cmoNone
  155.  
  156.     '' Register in VIEWER.INI
  157.     ModifyViewerIni
  158.  
  159.     '' Register custom fonts
  160.     RegisterCustomFonts
  161.  
  162.     '' Register drivers
  163.     RegisterDrivers
  164.     
  165.     '' Modify Program Manager
  166.     ModifyProgramManager    
  167.     
  168.     '' Success dialog
  169.     '' ShowSuccess
  170.     
  171.     '' Now start the title
  172.     '' RUN "mviewer2.exe " + MVBFileName$ + ".MVB", NOWAIT
  173.  
  174. QUIT:
  175.     
  176.     END
  177.     
  178.  
  179. '*************************************************************************
  180. '** Purpose:
  181. '**     Prompts the user for a path for the title files
  182. '** Arguments:
  183. '**     szDefault$ - default path
  184. '** Returns:
  185. '**     New valid path name, or "" if the user quit.
  186. '*************************************************************************
  187.  
  188. FUNCTION GetTitleDir (szDefault$) STATIC AS STRING
  189.  
  190.     SetSymbolValue "String", TitleShortName$
  191.     SetSymbolValue "EditTextIn", szDefault$
  192.     SetSymbolValue "EditFocus", "ALL"
  193.  
  194.     GETPATH:
  195.  
  196.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, "FHelpDlgProc")
  197.  
  198.     IF sz$ = "CONTINUE" THEN
  199.         szTitleDir$ = GetSymbolValue("EditTextOut")
  200.         IF IsDirWritable(szTitleDir$) = 0 THEN
  201.  
  202.             BADPATH:
  203.  
  204.             sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfoDlgProc", 0, "")
  205.             IF sz$ = "REACTIVATE" THEN
  206.                 GOTO BADPATH
  207.             END IF
  208.             UIPop 1
  209.             GOTO GETPATH
  210.         END IF
  211.         UIPop 1
  212.         CreateDir szTitleDir$, cmoNone
  213.     ELSEIF sz$ = "REACTIVATE" THEN
  214.         GOTO GETPATH
  215.  
  216.     ELSE
  217.         szTitleDir$ = ""
  218.  
  219.     END IF
  220.  
  221.     GetTitleDir = szTitleDir$
  222.  
  223. END FUNCTION
  224.  
  225.  
  226. '*************************************************************************
  227. '** Purpose:
  228. '**     Copies the files in the INF file
  229. '** Arguments:
  230. '**     szTitleDir$ - destination directory for the title files
  231. '** Returns
  232. '**     1 if files were copied, 0 otherwise
  233. '*************************************************************************
  234.  
  235. FUNCTION CopyFiles(szTitleDir$) STATIC AS INTEGER
  236.  
  237.     '' Add all system files to the copy list
  238.     AddSectionFilesToCopyList "System Files", GetSymbolValue("STF_SRCDIR"), GetWindowsSysDir()
  239.     
  240.     '' Add all of the title files to the copy list
  241.     AddSectionFilesToCopyList "Installed Title Files", GetSymbolValue("STF_SRCDIR"), szTitleDir$
  242.     
  243.     '' Check size
  244.     szExtras$ = "Extra"
  245.     szCosts$ = "Costs"
  246.     szNeededs$ = "Neededs"
  247.     FOR i% = 1 TO 26 STEP 1
  248.         AddListItem szExtras$, "0"
  249.     NEXT i%
  250.     
  251.     '' We assume that VIEWER.INI will take another 4K
  252.     ReplaceListItem szExtras$, ASC(MID$(GetWindowsDir(), 1, 1)) - ASC("A") + 1, STR$(4096)
  253.     
  254.     '' Get amount of space required
  255.     StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
  256.     
  257.     '' Put up a message if there is not enough space
  258.     FOR i% = 1 TO 26 STEP 1
  259.         IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN
  260.     
  261.             SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024))
  262.             SetSymbolValue "String2", CHR$(i% - 1 + ASC("A"))
  263.     
  264.             TOOBIG:
  265.     
  266.             sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, ""